//
//  TableViewCell.m
//  WeiboAD
//
//  Created by liu guoqiang on 16/7/19.
//  Copyright © 2016年 com.liu.weiboAD. All rights reserved.
//

#import "WeiboTableViewCell.h"
#import "ReactiveCocoa.h"

@implementation WeiboTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.weibo = [NSMutableDictionary dictionary];
    [RACObserve(self, weibo) subscribeNext:^(id x) {
        self.contentLabel.text = self.weibo[@"text"];
        NSDictionary *user = self.weibo[@"user"];
        self.nameLabel.text = user[@"name"];
        self.timeLabel.text = self.weibo[@"created_at"];
        [self.avatarImageView sd_setImageWithURL:[NSURL URLWithString:user[@"avatar_large"]] placeholderImage:[UIImage imageNamed:@"资讯选中"]];

    }];
    

    self.contentLabel.numberOfLines = 0;
    self.contentLabel.lineBreakMode = NSLineBreakByWordWrapping;
   
    CGSize size = [self sizeThatFits:CGSizeMake(self.contentLabel.frame.size.height, MAXFLOAT)];
    CGRect frame = self.contentLabel.frame;
    frame.size.height = size.height;
    [self.contentLabel setFrame:frame];
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
